package com.gangan.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gangan.model.ActivityApply;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gangan.model.view.ActivityView;
import com.gangan.model.view.CmsWishContentView;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 活动报名表 Mapper 接口
 * </p>
 *
 * @author jobob
 * @since 2019-09-07
 */
public interface ActivityApplyMapper extends BaseMapper<ActivityApply> {

    //查询用户所有活动，包括未审核，未参加，已完成等
    @Select("select apply.id, apply.activity_id, apply.`status`, activity.address,activity.label,activity.img_orogin,activity.img_thumb,\n" +
            "activity.start_time from tl_activity_apply apply,tl_activity activity where apply.activity_id = activity.id and apply.user_id = #{userId} and apply.del_flag=0  ORDER BY apply.create_time DESC")
    List<ActivityView> selectMyActivityListPage(Page<ActivityView> pagination, @Param("userId") Integer userId);

    //根据status（参加状态：0：未审核 1: 待参加 2：已完成）查询用户活动
    @Select("select apply.id, apply.activity_id, apply.`status`, activity.address,activity.label,activity.img_orogin,activity.img_thumb,\n" +
            "activity.start_time from tl_activity_apply apply,tl_activity activity where apply.activity_id = activity.id and apply.user_id = #{userId} and apply.`status`=#{status} and apply.del_flag=0  ORDER BY apply.create_time DESC")
    List<ActivityView> selectMyActivityListPageByType(Page<ActivityView> pagination, @Param("userId") Integer userId,@Param("status")Integer status);
}
